home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / OpenGL 1.0 SDK / Source / Libraries / aux / font.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-18  |  502 b   |  30 lines  |  [TEXT/CWIE]

  1. #include "tk.h"
  2. #include "aux.h"
  3.  
  4. static GLuint bitmapBaseInit = GL_TRUE;
  5. static GLuint bitmapBase = 0;
  6.  
  7. void auxCreateFont(void)
  8. {
  9.     if(!bitmapBaseInit) return;
  10.     bitmapBaseInit = GL_FALSE;
  11.  
  12.     bitmapBase = glGenLists(256);
  13.     if(tkCreateBitmapFont(bitmapBase) == GL_FALSE)
  14.     {
  15.         auxQuit();
  16.     }
  17. }
  18.  
  19. void auxDrawStr(char *str)
  20. {
  21.     if(bitmapBaseInit) auxCreateFont();
  22.     
  23.     glPushAttrib(GL_LIST_BIT);
  24.     
  25.     glListBase(bitmapBase);
  26.     glCallLists(strlen(str), GL_UNSIGNED_BYTE, (unsigned char *) str);
  27.     
  28.     glPopAttrib();
  29. }
  30.